<?php
App::uses('AppModel', 'Model');
/**
 * Product Model
 *
 * @property Warehouse $Warehouse
 * @property PurchaseDetail $PurchaseDetail
 * @property SalesDetail $SalesDetail
 * @property Modell $Modell
 */
class Product extends AppModel {
    public $displayField = 'serial_number';

    public $validate = array(
        'serial_number' => array(
            'maxLength' => array(
                'rule' => array('maxLength',10),
                //'message' => 'Your custom message here',
                //'allowEmpty' => false,
                //'required' => false,
                //'last' => false, // Stop validation after this rule
                //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
    );

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * belongsTo associations
 *
 * @var array
 */
	public $belongsTo = array(
		'Warehouse' => array(
			'className' => 'Warehouse',
			'foreignKey' => 'warehouse_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'PurchaseDetail' => array(
			'className' => 'PurchaseDetail',
			'foreignKey' => 'purchase_detail_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'SalesDetail' => array(
			'className' => 'SalesDetail',
			'foreignKey' => 'sales_detail_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Modell' => array(
			'className' => 'Modell',
			'foreignKey' => 'modell_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
}
